<?php

	 class User_google_model extends Model {
	 
	/**
	 * Constructor 
	 *
	 */
	  function User_google_model() 
	  {
		parent::Model();
				
      }//Controller End
	  
      /**
       * Update user google
       *
       * @access	private
       * @param	array	an associative array of insert values
       * @return	void
       */
      function updateUserGoogle($updateKey=array(),$updateData=array())
      {
      	$this->db->update('user_google',$updateData,$updateKey);
      		
      }//End of editGroup Function
      
      // --------------------------------------------------------------------
      
      
	
		
	 /**
	  * Add user google
	  *
	  * @access	private
	  * @param	array	an associative array of insert values
	  * @return	void
	  */
	 function addUserGoogle($insertData=array())
	 {
	 	return $this->db->insert('user_google', $insertData);
	 		
	 }
	
	/**
	 * Get User google
	 *
	 * @access	private
	 * @param	array	conditions to fetch data
	 * @return	object	object with result set
	 */
	 function getUserGoogle($conditions=array(),$fields='',$like=array(),$limit=array(),$order=array())
	 {
	 	if(count($conditions)>0)
	 		$this->db->where($conditions);
	 	
	 	if(is_array($like) and count($like)>0)
	 		$this->db->like($like);
	 	
	 	//Check For Limit
	 	if(is_array($limit))
	 	{
	 		if(count($limit)==1)
	 			$this->db->limit($limit[0]);
	 		else if(count($limit)==2)
	 			$this->db->limit($limit[0],$limit[1]);
	 	}
	 	
	 	if(is_array($order) and count($order)>0)
	 		$this->db->orderby($order[0],$order[1]);
	 	else
	 		$this->db->orderby('created','desc');
		
		$this->db->from('user_google');
		$this->db->join('users', 'users.id = user_google.user_id','inner');
		
		if($fields!='')
				$this->db->select($fields);
		else 		
	 		$this->db->select('user_google.id,user_google.google_id,user_google.avatar');
		 
		$result = $this->db->get();
		return $result;
		
	 }//End of getUsers Function
		
}

?>